package info.ms.neural.degrade;

import info.ms.neural.Adaptor;
import info.ms.neural.degrade.runner.IDegradeRunner;
import info.ms.neural.engine.entity.NeuralConf;

/**
 * 服务降级
 * <br>
 * 服务降级分类:<br>
 * 1.直接屏蔽降级<br>
 * 2.快速容错降级<br>
 * 3.自定义业务降级
 * <br>
 * 降级策略:<br>
 * 1.返回空<br>
 * 2.抛异常<br>
 * 3.本地mock<br>
 * 4.自定义策略
 * 
 * @author lry
 */
public interface IDegrade<REQ, RES> extends Adaptor {

	/**
	 * 服务降级
	 * 
	 * @param conf 神经配置
	 * @param route 路由器
	 * @param req 请求对象
	 * @return
	 * @throws Throwable
	 */
	RES degrade(NeuralConf conf, IDegradeRunner<REQ, RES> runner, REQ req, IBizDegrade<REQ, RES> bizDegrade) throws Throwable;
	
}
